<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<meta name="renderer" content="webkit">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<title>{$app_name}</title>
<link rel="stylesheet" type="text/css" href="__PUBLIC__/base.css" />
<link rel="stylesheet" type="text/css" href="__PUBLIC__/iconfont.css" />
<link rel="stylesheet" type="text/css" href="__PUBLIC__/admin/frame.css" />
<script type="text/javascript" src="__PUBLIC__/js/do.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/config.js"></script>
<script type="text/javascript" src="__PUBLIC__/js/Plug-in/laytpl/laytpl.js"></script>
</head>
<body>
<div id="header">
    <a href="/admin" class="logo"></a>
    <div class="nav">
        <ul>
        {foreach name="app_nav" item="vo" key="key" }
           <li class="action_nav{if condition="$key == 0"} focus{/if}" id="{$key}">{$vo.title}</li>
        {/foreach}
        </ul>
    </div>
    <div class="face">
        <a id="trigger" href="javascript:;" rel="faceBox"><div class="userface"><i class="iconfont icon-kehu"></i></div></a>
    </div>
</div>
<div id="menu">
    <ul id="TreeMenu" class="ztree"></ul>
</div>
<div id="action">
    <div id="pathMapsView"></div>
    <div id="editMenuView"></div>
</div> 
<div id="main">
    <iframe id="iframe" name="iframe" src="{:url('admin/index/welcome')}" frameborder="0"></iframe>
</div>
<div id="faceBox">
    <ul>
        <li class="line"><a href="//www.yxxxm.com" target="_blank"><i class="iconfont icon-home"></i>{$Think.lang.lang_ui_website}</a></li>
        <li class="line"><a href="//www.yxxxm.com" target="_blank"><i class="iconfont icon-wenhao"></i>{$Think.lang.lang_ui_help}</a></li>
        <li class="line"><a href="{:url('admin/user/password')}" target="iframe"><i class="iconfont icon-shenfen"></i>{$Think.lang.lang_ui_password}</a></li>
        <li class="line"><a href="{:url('admin/index/logout')}" target="_top"><i class="iconfont icon-shuaxin"></i>{$Think.lang.lang_ui_logout}</a></li>
    </ul>
</div>
<script id="editMenu" type="text/html">
    <ul>
    {{# for(var i = 0, len = d.list.length; i < len; i++){ }}
        <li><a href="{{d.list[i].url}}" target="{{# if(d._target){ }}{{ d._target }}{{# }else{ }}iframe{{# } }}">{{d.list[i].name}} </a></li>
    {{# } }}
    </ul>
</script> 
<script id="pathMaps" type="text/html">
    <ul>
    {{# for(var i = 0, len = d.list.length; i < len; i++){ }}
        <li><a href="{{d.list[i].url}}" target="{{# if(d._target){ }}{{ d._target }}{{# }else{ }}iframe{{# } }}">{{d.list[i].name}} </a></li>
    {{# } }}
    </ul>
</script> 
<script type = "text/javascript">
Do('layer','zTree','tip',function(){
    nav(0);
    $(".action_nav").click(function(){
        nav($(this).attr("id"));
    });
    $("#trigger").powerFloat({width:150,eventType:"hover",offsets: {x:50,y:50}});
})
//请求菜单数据
function nav(app){
    $(".action_nav").click(function() {
        $(".action_nav").removeClass("focus");
        $(this).addClass("focus");
    });  
    var menu_url = '{:url('admin/index/menu')}';
    $.getJSON(menu_url,{id:app},function(data){
        var setting = {data:{simpleData:{enable: true}},view:{dblClickExpand: false},callback:{onClick:onClick}};
        var zNodes = data; //JSON数组
        $.fn.zTree.init($("#TreeMenu"),setting,zNodes);
    }); 
}
//展开关闭
function onClick(e,treeId, treeNode) {
    var zTree = $.fn.zTree.getZTreeObj("TreeMenu");
    zTree.expandNode(treeNode);
}
//添加面包屑
function pathMaps(data){
    var data = {"list":data};
    var gettpl = $("#pathMaps").html();
    laytpl(gettpl).render(data, function(html){
        $("#pathMapsView").html(html);
    });
}
//添加管理菜单
function editMenu(data){
    var data = {"list":data};
    var gettpl = $("#editMenu").html();
    laytpl(gettpl).render(data, function(html){
        $("#editMenuView").html(html);
    });
}
</script>
</body>
</html>